import { observable, action, computed } from "mobx";
import { ajax } from "./../api/index";

class Data {
  @observable collapsed: boolean = false; //false  不收起  true 收起
  // @observable annoList=[]
  @observable userList: Array<any> = [];
  @observable adviseList: Array<any> = [];
  @observable xuekeList: Array<any> = [];
  @observable banjiList: Array<any> = [];

  @action getUserListAsync = async (payload: any) => {
    let { code, result } = await ajax.userlist(payload);
    if (code == 200) {
      this.userList = result;
    }
  };
  @action getUserList = (payload: any) => {
    this.userList = payload;
  };

  @action getBanJiListAsync = async (payload: any) => {
    let { code, result } = await ajax.banjilist(payload);
    if (code == 200) {
      this.banjiList = result;
    }
  };
  @action getBanJiList = (payload: any) => {
    this.banjiList = payload;
  };

  @action getXueKeListAsync = async (payload: any) => {
    let { code, result } = await ajax.xuekelist(payload);
    if (code == 200) {
      this.xuekeList = result;
    }
  };
  @action getXuekeList = (payload: any) => {
    this.xuekeList = payload;
  };

  @action getAdviseListAsync = async (payload: any) => {
    let { code, result } = await ajax.adviselist(payload);
    if (code == 200) {
      this.adviseList = result;
    }
  };

  @action getAdviseList = (payload: any) => {
    this.adviseList = payload;
  };

  @action changecollapsed = (payload: boolean) => {
    this.collapsed = payload;
  };
}

export default new Data();
